package org.example.controller;


import org.example.entity.Material;
import org.example.entity.PurchaseDetail;
import org.example.mapper.PurchaseDetailMapper;
import org.example.param.MaterialParam;
import org.example.param.PurchaseDetailParam;
import org.example.service.MaterialService;
import org.example.service.PurchaseDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.Map;


@RestController
@RequestMapping("/purchasedetail")

public class PurchaseDetailController {

    @Resource
    PurchaseDetailService purchaseDetailService;

    @PostMapping("/save")
    public Map<String, Object> save(PurchaseDetail purchaseDetail) {return purchaseDetailService.save(purchaseDetail);}
    @GetMapping("/page")
    public Map<String,Object> page(PurchaseDetailParam param) {
        return purchaseDetailService.page(param);
    }
    @PostMapping("/disable")
    public Map<String, Object> disable(PurchaseDetail purchaseDetail) {return purchaseDetailService.disable(purchaseDetail);}
    @PostMapping("/batch-import")
    public Map<String, Object> batchImport(MultipartFile file) {
        return purchaseDetailService.importExcel(file);
    }
}
